package doxygenxml.compound;

/**********************************************************************************************
 * Copyright (c) 2001-2020 Liquid Technologies Limited. All rights reserved.
 * See www.liquid-technologies.com for product details.
 *
 * Please see products End User License Agreement for distribution permissions.
 *
 * WARNING: THIS FILE IS GENERATED
 * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten
 *
 * Generation  :  by Liquid XML Data Binder 18.0.5.9988
 * Using Schema: CENSORED
 **********************************************************************************************/
public final class ClassFactory {
	private static java.util.Map<String, java.util.Map<String, Class<? extends com.liquid_technologies.ltxmllib18.XmlObjectBase>>> _nsMap = null;
	static {
		_nsMap = new java.util.HashMap<String, java.util.Map<String, Class<? extends com.liquid_technologies.ltxmllib18.XmlObjectBase>>>();
		java.util.Map<String, Class<? extends com.liquid_technologies.ltxmllib18.XmlObjectBase>> itemMap = null;
		itemMap = new java.util.HashMap<String, Class<? extends com.liquid_technologies.ltxmllib18.XmlObjectBase>>();
		itemMap.put("childnodeType", doxygenxml.compound.ChildnodeType.class);
		itemMap.put("codelineType", doxygenxml.compound.CodelineType.class);
		itemMap.put("compounddefType", doxygenxml.compound.CompounddefType.class);
		itemMap.put("compoundRefType", doxygenxml.compound.CompoundRefType.class);
		itemMap.put("descriptionType", doxygenxml.compound.DescriptionType.class);
		itemMap.put("docAnchorType", doxygenxml.compound.DocAnchorType.class);
		itemMap.put("docBlockQuoteType", doxygenxml.compound.DocBlockQuoteType.class);
		itemMap.put("docCaptionType", doxygenxml.compound.DocCaptionType.class);
		itemMap.put("docCaptionType_Group", doxygenxml.compound.DocCaptionType_Group.class);
		itemMap.put("docCopyType", doxygenxml.compound.DocCopyType.class);
		itemMap.put("docEmojiType", doxygenxml.compound.DocEmojiType.class);
		itemMap.put("docEmptyType", doxygenxml.compound.DocEmptyType.class);
		itemMap.put("docEntryType", doxygenxml.compound.DocEntryType.class);
		itemMap.put("docFormulaType", doxygenxml.compound.DocFormulaType.class);
		itemMap.put("docHeadingType", doxygenxml.compound.DocHeadingType.class);
		itemMap.put("docHeadingType_Group", doxygenxml.compound.DocHeadingType_Group.class);
		itemMap.put("docHtmlOnlyType", doxygenxml.compound.DocHtmlOnlyType.class);
		itemMap.put("docImageType", doxygenxml.compound.DocImageType.class);
		itemMap.put("docImageType_Group", doxygenxml.compound.DocImageType_Group.class);
		itemMap.put("docIndexEntryType", doxygenxml.compound.DocIndexEntryType.class);
		itemMap.put("docInternalS1Type", doxygenxml.compound.DocInternalS1Type.class);
		itemMap.put("docInternalS2Type", doxygenxml.compound.DocInternalS2Type.class);
		itemMap.put("docInternalS3Type", doxygenxml.compound.DocInternalS3Type.class);
		itemMap.put("docInternalS4Type", doxygenxml.compound.DocInternalS4Type.class);
		itemMap.put("docInternalType", doxygenxml.compound.DocInternalType.class);
		itemMap.put("docLanguageType", doxygenxml.compound.DocLanguageType.class);
		itemMap.put("docListItemType", doxygenxml.compound.DocListItemType.class);
		itemMap.put("docListType", doxygenxml.compound.DocListType.class);
		itemMap.put("docMarkupType", doxygenxml.compound.DocMarkupType.class);
		itemMap.put("docMarkupType_Group", doxygenxml.compound.DocMarkupType_Group.class);
		itemMap.put("docParamListItem", doxygenxml.compound.DocParamListItem.class);
		itemMap.put("docParamListType", doxygenxml.compound.DocParamListType.class);
		itemMap.put("docParamName", doxygenxml.compound.DocParamName.class);
		itemMap.put("docParamNameList", doxygenxml.compound.DocParamNameList.class);
		itemMap.put("docParamType", doxygenxml.compound.DocParamType.class);
		itemMap.put("docParaType", doxygenxml.compound.DocParaType.class);
		itemMap.put("docParaType_Group", doxygenxml.compound.DocParaType_Group.class);
		itemMap.put("docParaType_Group_Choice", doxygenxml.compound.DocParaType_Group_Choice.class);
		itemMap.put("docParBlockType", doxygenxml.compound.DocParBlockType.class);
		itemMap.put("docRefTextType", doxygenxml.compound.DocRefTextType.class);
		itemMap.put("docRefTextType_Group", doxygenxml.compound.DocRefTextType_Group.class);
		itemMap.put("docRowType", doxygenxml.compound.DocRowType.class);
		itemMap.put("docSect1Type", doxygenxml.compound.DocSect1Type.class);
		itemMap.put("docSect1Type_Choice", doxygenxml.compound.DocSect1Type_Choice.class);
		itemMap.put("docSect2Type", doxygenxml.compound.DocSect2Type.class);
		itemMap.put("docSect2Type_Choice", doxygenxml.compound.DocSect2Type_Choice.class);
		itemMap.put("docSect3Type", doxygenxml.compound.DocSect3Type.class);
		itemMap.put("docSect3Type_Choice", doxygenxml.compound.DocSect3Type_Choice.class);
		itemMap.put("docSect4Type", doxygenxml.compound.DocSect4Type.class);
		itemMap.put("docSect4Type_Choice", doxygenxml.compound.DocSect4Type_Choice.class);
		itemMap.put("docSimpleSectType", doxygenxml.compound.DocSimpleSectType.class);
		itemMap.put("docSimpleSectType_Seq", doxygenxml.compound.DocSimpleSectType_Seq.class);
		itemMap.put("docTableType", doxygenxml.compound.DocTableType.class);
		itemMap.put("docTitleType", doxygenxml.compound.DocTitleType.class);
		itemMap.put("docTitleType_Group", doxygenxml.compound.DocTitleType_Group.class);
		itemMap.put("docTocItemType", doxygenxml.compound.DocTocItemType.class);
		itemMap.put("docTocItemType_Group", doxygenxml.compound.DocTocItemType_Group.class);
		itemMap.put("docTocListType", doxygenxml.compound.DocTocListType.class);
		itemMap.put("docURLLink", doxygenxml.compound.DocURLLink.class);
		itemMap.put("docURLLink_Group", doxygenxml.compound.DocURLLink_Group.class);
		itemMap.put("docVariableListType", doxygenxml.compound.DocVariableListType.class);
		itemMap.put("docVariableListType_Seq", doxygenxml.compound.DocVariableListType_Seq.class);
		itemMap.put("docVarListEntryType", doxygenxml.compound.DocVarListEntryType.class);
		itemMap.put("docXRefSectType", doxygenxml.compound.DocXRefSectType.class);
		itemMap.put("doxygen", doxygenxml.compound.Doxygen.class);
		itemMap.put("enumvalueType", doxygenxml.compound.EnumvalueType.class);
		itemMap.put("graphType", doxygenxml.compound.GraphType.class);
		itemMap.put("highlightType", doxygenxml.compound.HighlightType.class);
		itemMap.put("highlightType_Group", doxygenxml.compound.HighlightType_Group.class);
		itemMap.put("incType", doxygenxml.compound.IncType.class);
		itemMap.put("linkedTextType", doxygenxml.compound.LinkedTextType.class);
		itemMap.put("linkType", doxygenxml.compound.LinkType.class);
		itemMap.put("listingType", doxygenxml.compound.ListingType.class);
		itemMap.put("listofallmembersType", doxygenxml.compound.ListofallmembersType.class);
		itemMap.put("locationType", doxygenxml.compound.LocationType.class);
		itemMap.put("memberdefType", doxygenxml.compound.MemberdefType.class);
		itemMap.put("memberRefType", doxygenxml.compound.MemberRefType.class);
		itemMap.put("nodeType", doxygenxml.compound.NodeType.class);
		itemMap.put("paramType", doxygenxml.compound.ParamType.class);
		itemMap.put("referenceType", doxygenxml.compound.ReferenceType.class);
		itemMap.put("refTextType", doxygenxml.compound.RefTextType.class);
		itemMap.put("refType", doxygenxml.compound.RefType.class);
		itemMap.put("reimplementType", doxygenxml.compound.ReimplementType.class);
		itemMap.put("sectiondefType", doxygenxml.compound.SectiondefType.class);
		itemMap.put("spType", doxygenxml.compound.SpType.class);
		itemMap.put("tableofcontentsKindType", doxygenxml.compound.TableofcontentsKindType.class);
		itemMap.put("tableofcontentsType", doxygenxml.compound.TableofcontentsType.class);
		itemMap.put("templateparamlistType", doxygenxml.compound.TemplateparamlistType.class);
		_nsMap.put("", itemMap);
	}

	/**
	 *  Creates an object from XML data held in a string.
	 *
	 *  @param	xmlIn		The data to be loaded
	 *  @return				The wrapper object, loaded with the supplied data
	 *  @throws	LtException	Throws an exception if the XML data is not compatible with the schema</remarks>
	 *  @throws	IOException
	 */
	public static com.liquid_technologies.ltxmllib18.XmlObjectBase fromXml(String xmlIn)
		throws com.liquid_technologies.ltxmllib18.exceptions.LtException, java.io.IOException {
		return fromXml( xmlIn, com.liquid_technologies.ltxmllib18.SerializationContext.Default );
	}
	/**
	 *  Creates an object from XML data held in a string.
	 *
	 *  @param	xmlIn		The data to be loaded
	 *  @param	context		The context to use when loading the data
	 *  @return				The wrapper object, loaded with the supplied data
	 *  @throws	LtException	Throws an exception if the XML data is not compatible with the schema</remarks>
	 *  @throws	IOException
	 */
	public static com.liquid_technologies.ltxmllib18.XmlObjectBase fromXml(String xmlIn, com.liquid_technologies.ltxmllib18.SerializationContext context)
		throws com.liquid_technologies.ltxmllib18.exceptions.LtException, java.io.IOException {
		com.liquid_technologies.ltxmllib18.dom.XmlDocument parser = new com.liquid_technologies.ltxmllib18.dom.XmlDocument();
		parser.parse(new java.io.ByteArrayInputStream(xmlIn.getBytes()), context);
		return fromXmlElement(parser.getDocumentElement(), context);
	}

	/**
	 *  Creates an object from XML data held in a File
	 *
	 *  @param	FileName	The file to be loaded
	 *  @return				The wrapper object, loaded with the supplied data
	 *  @throws	LtException	Throws an exception if the XML data is not compatible with the schema</remarks>
	 *  @throws	IOException
	 */
	public static com.liquid_technologies.ltxmllib18.XmlObjectBase fromXmlFile(String FileName)
		throws com.liquid_technologies.ltxmllib18.exceptions.LtException, java.io.IOException {
		return fromXmlFile(FileName, com.liquid_technologies.ltxmllib18.SerializationContext.Default);
	}
	/**
	 *  Creates an object from XML data held in a File
	 *
	 *  @param	FileName	The file to be loaded
	 *  @param	context		The context to use when loading the data
	 *  @return				The wrapper object, loaded with the supplied data
	 *  @throws	LtException	Throws an exception if the XML data is not compatible with the schema</remarks>
	 *  @throws	IOException
	 */
	public static com.liquid_technologies.ltxmllib18.XmlObjectBase fromXmlFile(String FileName, com.liquid_technologies.ltxmllib18.SerializationContext context)
		throws com.liquid_technologies.ltxmllib18.exceptions.LtException, java.io.IOException {
		com.liquid_technologies.ltxmllib18.dom.XmlDocument parser = new com.liquid_technologies.ltxmllib18.dom.XmlDocument();
		parser.parse(FileName, context);
		return fromXmlElement(parser.getDocumentElement(), context);
	}

	/**
	 *  Creates an object from XML data held in a stream.
	 *
	 *  @param	stream		The data to be loaded
	 *  @return				The wrapper object, loaded with the supplied data
	 *  @throws	LtException	Throws an exception if the XML data is not compatible with the schema</remarks>
	 *  @throws	IOException
	 */
	public static com.liquid_technologies.ltxmllib18.XmlObjectBase fromXmlStream(byte[] data)
		throws com.liquid_technologies.ltxmllib18.exceptions.LtException, java.io.IOException {
		return fromXmlStream(data, com.liquid_technologies.ltxmllib18.SerializationContext.Default);
	}
	/**
	 *  Creates an object from XML data held in a stream.
	 *
	 *  @param	stream		The data to be loaded
	 *  @return				The wrapper object, loaded with the supplied data
	 *  @throws	LtException	Throws an exception if the XML data is not compatible with the schema</remarks>
	 *  @throws	IOException
	 */
	public static com.liquid_technologies.ltxmllib18.XmlObjectBase fromXmlStream(byte[] data, com.liquid_technologies.ltxmllib18.SerializationContext context)
		throws com.liquid_technologies.ltxmllib18.exceptions.LtException, java.io.IOException {
		com.liquid_technologies.ltxmllib18.dom.XmlDocument parser = new com.liquid_technologies.ltxmllib18.dom.XmlDocument();
		java.io.ByteArrayInputStream baStream = new java.io.ByteArrayInputStream(data);
		parser.parse(baStream, context);
		return fromXmlElement(parser.getDocumentElement(), context);
	}
		
	/**
	 *  Creates an object from an XML Element.
	 *
	 *  @param	xmlParent	The data that needs loading
	 *  @return				The wrapper object, loaded with the supplied data
	 *  @throws	LtException	Throws an exception if the XML data is not compatible with the schema</remarks>
	 *  @throws	IOException
	 */
	public static com.liquid_technologies.ltxmllib18.XmlObjectBase fromXmlElement(com.liquid_technologies.ltxmllib18.dom.XmlElement xmlParent)
		throws com.liquid_technologies.ltxmllib18.exceptions.LtException, java.io.IOException {
		return fromXmlElement(xmlParent, com.liquid_technologies.ltxmllib18.SerializationContext.Default);
	}
	/**
	 *  Creates an object from an XML Element.
	 *
	 *  @param	xmlParent	The data that needs loading
	 *  @param	context		The context to use when loading the data
	 *  @return				The wrapper object, loaded with the supplied data
	 *  @throws	LtException	Throws an exception if the XML data is not compatible with the schema</remarks>
	 *  @throws	IOException
	 */
	public static com.liquid_technologies.ltxmllib18.XmlObjectBase fromXmlElement(com.liquid_technologies.ltxmllib18.dom.XmlElement xmlParent, com.liquid_technologies.ltxmllib18.SerializationContext context)
		throws com.liquid_technologies.ltxmllib18.exceptions.LtException, java.io.IOException {

		com.liquid_technologies.ltxmllib18.XmlObjectBase retVal = null;
		String elementName;
		String elementNamespaceUri;

		// Get the type name this is either 
		// from the element i.e. <Parent>... = Parent
		// or from the type i.e. <Parent xsi:type="someNS:SomeElement">... = SomeElement
		elementName = com.liquid_technologies.ltxmllib18.ClassFactoryHelper.getElementType(xmlParent);
		if (elementName.length() == 0) {
			elementName = xmlParent.getLocalName();
			elementNamespaceUri = xmlParent.getNamespaceURI();
		} else {
			elementNamespaceUri = com.liquid_technologies.ltxmllib18.ClassFactoryHelper.getElementTypeNamespaceUri(xmlParent);
		}

		// create the appropriate object
		retVal = com.liquid_technologies.ltxmllib18.ClassFactoryHelper.createObject(_nsMap, elementName, elementNamespaceUri, context);
		if (retVal == null) {
			throw new com.liquid_technologies.ltxmllib18.exceptions.LtException("Failed load the element " + elementName + ":" + elementNamespaceUri + ". No appropriate class exists to load the data into. Ensure that the XML document complies with the schema.");
		}

		// load the data into the object
		retVal.fromXmlElement(xmlParent, context);

		return retVal;
	}
}

